package com.sc.design.builder.chaininvoke;

public class User {
    private  String username;
    private String password;
    private String tel;
    private String address;

    public User(UserBuilder userBuilder){
        this.username = userBuilder.username;
        this.password = userBuilder.password;
        this.tel = userBuilder.tel;
        this.address = userBuilder.address;
    }
    public void hello(){
        System.out.println(":hello");
    }
    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public String getTel() {
        return tel;
    }

    public String getAddress() {
        return address;
    }

    public static class UserBuilder{
        private final String username;
        private final String password;
        private String tel;
        private String address;

        public UserBuilder(String username,String password){
            this.username=username;
            this.password=password;
        }

        public UserBuilder tel(String tel){
            this.tel = tel;
            return this;
        }
        public UserBuilder address(String address){
            this.address = address;
            return this;
        }
        public User builder(){
            return new User(this);
        }

    }
}
